<!-- Ndas -->
<div class="main-window-segment" style="padding-top: none; padding-bottom: 20px;">
    <div class="container-fluid">
        <div class="row">

            <div class="col-lg-10 col-md-6 col-sm-12">
                <h2 id="judul"><?php echo $this->judul; ?></h2>
            </div>

            <div class="col-lg-1 col-md-3 col-sm-12" style="padding-top: 20px;">

                <?php
//----------------------------------------------------
//Development History.Revisi : 0 Kegiatan :1.mencetak hasil filter ke dalam pdf Dibuat oleh : Rifan Abdul Rachman Tanggal dibuat : 18-07-2014  File yang diubah : fund_fail.php  

				if (isset($this->code)) {
                    $code = $this->code;
                } else {
                    $code = 'null';
                }

                if (isset($this->judul)) {
                    $kdjudul = $this->judul;
                } else {
                    $kdjudul = 'null';
                }
                
                $kdaksi = $this->action;
                $kdaksi1 = $kdaksi . '_BAES1_PDF';
                ?>
                <div class="btn-group-sm">
                    <button type="button" class="btn btn-default dropdown-toggle fullwidth" data-toggle="dropdown" aria-expanded="false"><span class="glyphicon glyphicon-print"></span>&nbsp; Cetak <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="<?php echo URL; ?>PDF/<?php echo $kdaksi1; ?>/<?php echo $code . "/" . $kdjudul; ?>/PDF">PDF</a></li>
                        <li><a href="<?php echo URL; ?>PDF/<?php echo $kdaksi1; ?>/<?php echo $code . "/" . $kdjudul; ?>/XLS">EXCEL</a></li>																	
                    </ul>
                </div>					

                <?php
//------------------------------
                ?>
            </div>
            <div class="col-lg-1 col-md-3 col-sm-12" style="padding-top: 20px;">
                <button type="button" style="width: 100%" class="btn btn-default" data-toggle="modal" data-target="#modal-app-filter"><span class="glyphicon glyphicon-filter"></span> Filter</button>
            </div>
        </div>

        <div class="row" style="padding-top: 10px">

            <div class="col-md-6 col-sm-12" style="text-align: left;">
                <?php
                // untuk menampilkan last_update
                if (isset($this->last_update)) {
                    foreach ($this->last_update as $last_update) {
                        echo "Update Data Terakhir (Waktu Server) :<br> " . $last_update->get_last_update() . " WIB";
                    }
                }
                ?>
            </div>

        </div>

    </div>
</div>

<!-- Tabel -->
<div id="table-container" class="wrapper">
    <table class="footable">
        <!--baris pertama-->
        <thead>
            <tr>
                <th class='mid'>No.</th>
                <th class='mid'>Nama Pembiayaan</th>
                <th class='mid'>Negara </th>
                <th class='mid'>Kreditur</th>
                <th class='mid'>Kode<br>Dana</th>
                <th class='mid'>Pagu</th>
                <th class='mid'>Realisasi</th>
                <th class='mid'>Persentase</th>
            </tr>
        </thead>
        <tbody class='ratatengah'>
            <?php
            $no = 1;
            $tot_pagu = 0;
            $tot_real = 0;
            if (isset($this->data)) {
                if (empty($this->data)) {
                    echo '<td colspan=12 align="center">Tidak ada data.</td>';
                } else {
                    foreach ($this->data as $value) {
                        echo "<tr>	";
                        echo "<td>" . $no++ . "</td>";
                        echo "<td align='left'>" . $value->get_satker() . "</td>";
                        echo "<td align='left'>" . $value->get_nm_satker() . "</td>";
                        echo "<td align='left'>" . $value->get_kdkegiatan() . "</td>";
                        echo "<td align='left'>" . $value->get_nmkegiatan() . "</td>";
                        echo "<td align='right'>" . number_format($value->get_budget_amt()) . "</td> ";
                        echo "<td align='right'>" . number_format(abs($value->get_actual_amt())) .
                        "</td> ";
                        echo "<td align='right'>";
                        if ($value->get_budget_amt() == 0) {
                            echo "0.00%";
                        } else {
                            echo number_format(($value->get_actual_amt() / $value->get_budget_amt()) * 100, 2) . "%";
                            "</td> ";
                        }
                        echo "</tr>	";

                        $tot_pagu+=$value->get_budget_amt();
                        $tot_real+=$value->get_actual_amt();
                        $tot_kontrak += $value->get_obligation();
                        $tot_block += $value->get_block_amount();
                        $tot_balance += $value->get_balancing_amt();
                    }
                    echo "<tr>";
                    echo "</tr>";
                }
            } else {

                echo '<td colspan=12 id="filter-first" align="center">Masukkan filter terlebih dahulu.</td>';
            }
            ?>
        </tbody>
        <tfoot>

            <tr>
                <td colspan='5' rowspan=1 class='ratatengah'><b>GRAND TOTAL<b></td>
                            <td align='right'><b> <?php echo number_format($tot_pagu); ?> </b> </td>
                            <td align='right'><b> <?php echo number_format(abs($tot_real)); ?> </b></td>
                            <td align='right'><b> <?php
                                    if ($tot_pagu == 0) {
                                        echo '0.00%';
                                    } else {
                                        echo number_format($tot_real / $tot_pagu * 100, 2) . '%';
                                    }
                                    ?> </b></td>
            </tr>
            <tr><td colspan="9" class='ratatengah'><b><font color="blue">Disclaimer: Realisasi berbasis akrual dan bersifat bruto</font></b></td>

                            </tfoot>
                            </table>
                            </div>

                            <div class="modal fade" id="modal-app-filter" tabindex="-1" role="dialog" aria-labelledby="app-filter-label" aria-hidden="true">

                                <div class="modal-dialog">

                                    <div class="modal-content">

                                        <div class="modal-header">

                                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Tutup</span></button>
                                            <h4 class="modal-title" id="app-filter-label"><span class="glyphicon glyphicon-filter"></span> Filter Data</h4>

                                        </div>

                                        <form id="filter-form" method="POST" action=<?php echo $this->action; ?> enctype="multipart/form-data">

                                            <div class="modal-body">

                                                <div id="wkdkppn" class="alert alert-danger" style="display:none;"></div>

                                                <label class="isian"><?php echo $this->kodes; ?> </label>
                                                <input class="form-control" type="text" name="kode" id="kode" value="<?php
                                                if (isset($this->kode)) {
                                                    echo $this->kode;
                                                }
                                    ?>">
                                                <label class="isian" >Nama : </label>
                                                <input class="form-control" type="text" name="nama" id="nama" value="<?php
                                                if (isset($this->kode)) {
                                                    echo $this->nama;
                                                }
                                    ?>">

                                            </div>

                                            <div class="modal-footer">
                                                <button type="submit" name="submit_file" class="btn btn-primary" style="width: 100%" onClick="return cek_upload()">Kirim</button>
                                            </div>

                                        </form>

                                    </div>

                                    <script type="text/javascript" charset="utf-8">
                                        $(function () {
                                            hideErrorId();
                                            hideWarning();

                                        });

                                        function hideErrorId() {
                                            $('.alert-danger').fadeOut(0);
                                        }

                                        function hideWarning() {
                                            $('#status').change(function () {
                                                if (document.getElementById('status').value != '') {
                                                    $('#wstatus').fadeOut(200);
                                                }
                                            });

                                        }

                                        function cek_upload() {
                                            var v_status = document.getElementById('kode').value;
                                            var v_status1 = document.getElementById('nama').value;

                                            var jml = 0;
                                            if (v_status == '' and v_status1 == '') {
                                                $('#wstatus').html('Harap pilih');
                                                $('#wstatus').fadeIn();
                                                jml++;
                                            }
                                            if (jml > 0) {
                                                return false;
                                            }
                                        }
                                    </script>

                                </div>

                            </div>
